using EnvDTE80;
using Microsoft.Practices.RecipeFramework;
using Microsoft.Practices.RecipeFramework.Library;
using VSSDKAssist.Assets.Actions.Base;

namespace VSSDKAssist.Assets.Actions.VisualStudio
{
	/// <summary>
	/// Action that adds a solution folder
	/// </summary>
	public class AddSolutionFolderAction : ActionBase
	{
		#region Input Properties
		private string solutionFolderName;

		/// <summary>
		/// Gets or sets the name of the solution folder.
		/// </summary>
		/// <value>The name of the solution folder.</value>
		[Input(Required = true)]
		public string SolutionFolderName
		{
			get { return solutionFolderName; }
			set { solutionFolderName = value; }
		}

		/// <summary>
		/// Called when [execute].
		/// </summary>
		protected override void OnExecute()
		{
			if(DteHelper.FindProjectByPath(
				VisualStudio.Solution,
				this.solutionFolderName) == null)
			{
				Solution2 solution = (Solution2)VisualStudio.Solution;

				solution.AddSolutionFolder(this.solutionFolderName);
			}
		}
		#endregion
	}
}
